package controllers

import javax.inject._
import play.api.http.MimeTypes
import play.api.mvc._
import play.api.routing.JavaScriptReverseRouter
import services.dingtalk.{DingtalkConfig, DingtalkService}

import scala.concurrent.ExecutionContext

/**
 * This controller creates an `Action` to handle HTTP requests to the
 * application's home page.
 */
@Singleton
class HomeController @Inject()(cc: ControllerComponents)(implicit exec: ExecutionContext, parser: BodyParsers.Default)
  extends AbstractController(cc) {
  implicit val myCustomCharset = Codec.javaSupported("gb18030")
  /**
   * Create an Action to render an HTML page with a welcome message.
   * The configuration in the `routes` file means that this method
   * will be called when the application receives a `GET` request with
   * a path of `/`.
   */

  def index() = Action { implicit request =>
    Ok(views.html.index("Your new application is ready.中"))
  }

  def javascriptRoutes() = Action { implicit request =>
    Ok(
      JavaScriptReverseRouter("jsRoutes")(
        routes.javascript.HomeController.index,
        routes.javascript.LayuiController.index,
        routes.javascript.LayuiController.upload,
        routes.javascript.UsersController.authUser,
        routes.javascript.UsersController.index,
        routes.javascript.UsersController.dingTalkAuth,
        routes.javascript.UsersController.login,
        routes.javascript.UsersController.logout,
        routes.javascript.UsersController.pwdUpdated,
        routes.javascript.UsersController.updatePWD,
        routes.javascript.UserNasController.userUpdate,
        routes.javascript.KanbanController.kbdata,
        routes.javascript.KanbanController.kboperation,
        controllers.admin.routes.javascript.AdminController.index,
        controllers.admin.routes.javascript.TasksController.addTask,
        controllers.admin.routes.javascript.TasksController.editTask,
        controllers.admin.routes.javascript.TasksController.index,
        controllers.admin.routes.javascript.TasksController.indexPost,
        controllers.admin.routes.javascript.TasksController.jobExecutions,
        controllers.admin.routes.javascript.TasksController.listJobExecutions,
        controllers.admin.routes.javascript.TasksController.removeJobExecutions,
        controllers.admin.routes.javascript.NasController.userList,
        controllers.admin.routes.javascript.NasController.groupList,
        controllers.admin.routes.javascript.NasController.userLocked,
        controllers.admin.routes.javascript.NasController.userChangeGroup,
        controllers.admin.routes.javascript.NasController.groupCreate,
        controllers.admin.routes.javascript.NasController.nasGroupsCheck,
        controllers.admin.routes.javascript.NasController.nasUsersCheck,
        controllers.admin.routes.javascript.NasController.setGroupAsNasGroupId,
        controllers.admin.routes.javascript.UsersController.index,
        controllers.admin.routes.javascript.UsersController.getList,
        controllers.admin.routes.javascript.UsersController.updatePermission,
        controllers.admin.routes.javascript.WiFiController.save,
        controllers.admin.routes.javascript.RobotMsgController.index,
        controllers.admin.routes.javascript.RobotMsgController.talk,
        controllers.admin.routes.javascript.RobotMsgController.message,
        controllers.admin.routes.javascript.SystemUsersController.index,
        controllers.admin.routes.javascript.SystemUsersController.osuser,
        controllers.user.routes.javascript.KisOutStockController.ossFEntityCount,
        controllers.user.routes.javascript.KisOutStockController.outStockRevView,
        controllers.user.routes.javascript.KisOutStockController.outStockSumView,
        controllers.user.routes.javascript.KisOutStockController.sumOutStockRev,
        controllers.user.routes.javascript.KisOutStockController.sendOutStockSum,
        controllers.user.routes.javascript.KisOutStockController.getDataFromGy,
        controllers.user.routes.javascript.KisOutStockController.testJson,
        controllers.user.routes.javascript.KisStockStoreNowController.show

      )
    ).as(MimeTypes.JAVASCRIPT)
  }


}



